package exception;

import java.util.Scanner;

public class demo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        scanner.nextInt();
        int n = 1;
        One one = null;
        switch (n) {
            case 1:
                one = new Two();
                break;
            case 2:
                one = new Three();
                break;
        }
        if (one instanceof Two) {
            Two two = (Two) one;
            System.out.println("成功转换");
        } else if (one instanceof Three) {
            Three three = (Three) one;
            System.out.println("成功转换");

        }
    }
}

class One {

}

class Two extends One {

}

class Three extends One {

}
